package com.usian.ai.controller;

import com.usian.ai.common.Result;
import com.usian.ai.common.vo.LoginReqVo;
import com.usian.ai.service.AdminService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @TODO:
 * @Author:baimu
 * @Date:2024 12 03 10 03
 **/

@RestController
@RequestMapping("admin")
@Slf4j
@CrossOrigin
public class AdminController {

    @Autowired
    AdminService adminService;

    /**
     * service 抛异常----------》controller--》 try catch 捕获异常，处理异常
     *
     *
     * service 抛异常----------》controller  接异常--》 框架，处理异常 全局
     * @param loginReqVo
     * @return
     */
    @PostMapping("login")
    public Result login(@Validated @RequestBody LoginReqVo loginReqVo){
        log.info("接受参数：{}",loginReqVo.toString());


            Result result = adminService.login(loginReqVo);
            return result;


    }






}
